const express=require("express");
const path=require("path");
var web=new express();//实例化服务器
web.get("/",function (requist,response) {
    let main="./main.html";//相对路径
    main=path.resolve(main);//转化为绝对路径
    response.sendFile(main);
});

let products=[];//100个
for (let i=1;i<=100;i++){
    let product={id:i,name:"产品"+i,price:"价格"+i,brand:"品牌"+i,};
    products.push(product);
}
web.get("/mian.html",function (req,res) {
    let main="./main.html";//相对路径
    main=path.resolve(main);//转化为绝对路径
    res.sendFile(main);
});

web.use("/static",express.static(__dirname+"/web/static"));
//启动服务
var server=web.listen(8090,function () {
    var host=server.address().address;
    var post=server.address().port;
    console.log("应用实例，访问地址http:%s:%s",host,post);
});
